package kmeans;

import io.PropertiesLoader;
import io.PropertiesXMLLoader;

import java.util.ArrayList;
import java.util.List;
import java.util.Properties;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

import postProcess.SaveClusterResult;
import preProcess.LoadData;
import tools.Pair;
import weka.core.EuclideanDistance;

public class test
{
	 public static void main(String[] args)
	 {
		
		 Logger myLogger= Logger.getLogger("myLogger");   
		 PropertyConfigurator.configure("pro\\log4j.properties");
		 /*
		 try
		 {
			
				 PropertiesXMLLoader pro=new PropertiesXMLLoader("pro\\conf.xml");
				 PropertiesXMLLoader para=new PropertiesXMLLoader("pro\\dataPara.xml");
				 
				 
				 LoadData testData=LoadData.getLoadData(myLogger,pro,para);
				 
				 PropertiesXMLLoader xMeansPara=new PropertiesXMLLoader("pro\\xMeansPara2.xml");
				 
				 TextXmeansWekaEnhancer textCluster= TextXmeansWekaEnhancer.getCluster(myLogger,testData.getDataSetName(),xMeansPara);
				 
		
				 textCluster.buildCluster(testData.getTextDataSet(), testData.getWordIDMap(0));
				 SaveClusterResult saveHander=new SaveClusterResult(pro);
				 
				 saveHander.run(para, testData.getDataSetName()+textCluster.getAlgorithmName(), textCluster.getClusterResult(testData.getTextDataSet()));
			 
			 
			 
			 //
		 }
		 catch(Exception e)
		 {
			 e.printStackTrace();
		 }*/
		 
		 try
		 {
			
				 PropertiesXMLLoader pro=new PropertiesXMLLoader("pro\\conf.xml");
				 PropertiesXMLLoader para=new PropertiesXMLLoader("pro\\dataPara.xml");
				 
				 
				 LoadData testData=LoadData.getLoadData(myLogger,pro,para);
				 
				 PropertiesXMLLoader xMeansPara=new PropertiesXMLLoader("pro\\xMeansParaKD.xml");
				 
				 TextXmeansWekaEnhancer textCluster= TextXmeansWekaEnhancer.getCluster(myLogger,testData.getDataSetName(),xMeansPara);
				
				// myLogger.info("use KDTREE");
				// textCluster.useKDTree();
				 textCluster.buildCluster(testData.getTextDataSet(), testData.getWordIDMap(0));
				 SaveClusterResult saveHander=new SaveClusterResult(pro);
				 
				 saveHander.run(para, testData.getDataSetName()+textCluster.getAlgorithmName(), textCluster.getClusterResult(testData.getTextDataSet()));
			 
			 
			 
			 //
		 }
		 catch(Exception e)
		 {
			 e.printStackTrace();
		 }
		
		 
	 }
	
		
	
		
}
